// 变量管理相关接口

import services, { servicesSmp } from '../createServices';

// 指标管理
export const indicator = {
  add: (params) => services.post('/feature/create', { params, isLoading: true }),
  update: (params) => services.post('/feature/edit', { params, isLoading: true }),
  delete: (params) => services.post('/feature/delete', { params, isLoading: true }),
  list: (params) => services.post('/feature/list', { params, isLoading: true }),
  batchDelete: (params) => services.post('/feature/batch-delete', { params, isLoading: true }),
  batchStop: (params) => services.post('/feature/batch-stop', { params, isLoading: true }),
  unusedList: (params) => services.post('/feature/unused-list', { params, isLoading: true }),
  getVariableList: (params) => services.post('/feature/get-variable-list', { params }),
  getOperatorList: (params) => services.post('/feature/operator-list', { params }),
  statistics: (params) => services.post('/feature-statistics/dashboard', { params, isLoading: true }),
  versions: (params) => services.post('/feature/version-list', { params, isLoading: true }),
  detail: (params) => services.post('/feature/detail', { params, isLoading: true }),
};

// 字段管理
export const field = {
  add: (params) => services.post('/field/create', { params, isLoading: true }),
  update: (params) => services.post('/field/edit', { params, isLoading: true }),
  delete: (params) => services.post('/field/delete', { params, isLoading: true }),
  list: (params) => services.post('/field/list', { params, isLoading: true }),
  getFieldCodeList: (params) => services.post('/field/get-field-code-list', { params }),
  queryOne: (params) => services.post('/field/detail', { params, isLoading: true }),
  dataTypeList: (params) => services.post('/data-type/list', { params, isLoading: true }),
  copy: (params) => services.post('/field/copy', { params, isLoading: true }),
  fieldEnumeration: (params) => services.post('/field-enumeration/list', { params, isLoading: true }),
  fieldEnumerationCreate: (params) => services.post('/field-enumeration/create', { params, isLoading: true }),
};

// 计算方式管理
export const computeMode = {
  add: (params) => services.post('/calculate-type/create', { params, isLoading: true }),
  update: (params) => services.post('/calculate-type/edit', { params, isLoading: true }),
  delete: (params) => services.post('/calculate-type/delete', { params, isLoading: true }),
  list: (params) => services.post('/calculate-type/list', { params, isLoading: true }),
  getCodeList: (params) => services.post('/calculate-type/get-code-list', { params }),
};

// 函数
export const action = {
  actionList: (params) => services.post('/action/list', { params, isLoading: true }),
};

// 名单管理
export const nameList = {
  add: (params) => services.post('/namelist/create', { params, isLoading: true }),
  addData: (params) => services.post('/namelist/add-name-list-data', { params, isLoading: true }),
  update: (params) => services.post('/namelist/edit', { params, isLoading: true }),
  delete: (params) => services.post('/namelist/delete', { params, isLoading: true }),
  list: (params) => services.post('/namelist/list', { params, isLoading: true }),
  detail: (params) => services.post('/namelist/detail', { params, isLoading: true }),
  statistics: (params) => services.post('/namelist/statistics', { params, isLoading: true }),
  variableList: (params) => services.post('/namelist/get-variable-list', { params, isLoading: true }), //本地名单
  variableListThird: (params) => services.post('/third-namelist/get-variable-list', { params, isLoading: true }), //第三方名单
  searchNameList: (params) => services.post('/namelist/search-name-list', { params }),
};

// 名单管理---名单详情数据
export const nameListDetail = {
  add: (params) => services.post('/namelist/detail-add', { params, isLoading: true }),
  list: (params) => services.post('/namelist/detail-list', { params, isLoading: true }),
  update: (params) => services.post('/namelist/detail-edit', { params, isLoading: true }),
  updateStatus: (params) => services.post('/namelist/set-data-status', { params, isLoading: true }),
  setValidTime: (params) => services.post('/namelist/set-valid-time', { params, isLoading: true }),
  export: (params) => services.get('/namelist/export', { params, isLoading: true }),
  upload: (params) => services.get('/namelist/import', { params, isLoading: true }),
};

// 三方名单管理 映射管理
export const outerList = {
  getNameList: (params) => services.get('/third-namelist/get-name-list', { params, isLoading: true }),
  getNameListDetail: (params) => services.post('/third-namelist/detail', { params, isLoading: true }),
  add: (params) => services.post('/third-namelist/batch-create-mapping', { params, isLoading: true }),
  update: (params) => services.post('/third-namelist/edit', { params, isLoading: true }),
  updateMapping: (params) => services.post('/third-namelist/batch-update-mapping', { params, isLoading: true }),
  delete: (params) => services.post('/third-namelist/delete', { params, isLoading: true }),
  list: (params) => services.post('/third-namelist/list', { params, isLoading: true }),
  testConnection: (params) => services.post('/third-namelist/test-connection', { params, isLoading: true }),
  getMapping: (params) => services.post('/third-namelist/get-mapped-relation', { params, isLoading: true }),
  smartMap: (params) => services.post('/third-namelist/intelligent-mapping', { params, isLoading: true }),
  syncBankDataSource: (params) => services.post('/third-namelist/sync-bank-data-source', { params }),
  interfaceGroupList: () => services.post('/third-namelist/api-group-list', { isLoading: true }),
  getChildMapList: (params) => services.post('/third-namelist/get-list-map', { params, isLoading: true }),
  deleteMap: (params) => services.post('/third-list-map/delete', { params, isLoading: true }),
  remark: (params) => services.post('/third-namelist/edit-remark', { params }),
  fieldList: (params) => services.post('/field/get-field-list', { params, isLoading: true }),
  mapEvent: (params) => services.post('/third-namelist/check-map-repeat', { params, isLoading: true }),
};

//  自定义参数
export const customParams = {
  list: (params) => services.post('/third-list-param/list', { params, isLoading: true }),
  add: (params) => services.post('/third-list-param/create', { params, isLoading: true }),
  update: (params) => services.post('/third-list-param/edit', { params, isLoading: true }),
  detail: (params) => services.post('/third-list-param/detail', { params }),
  delete: (params) => services.post('/third-list-param/delete', { params, isLoading: true }),
  getResourceList: (params) => services.post('/third-list-param/resource', { params, isLoading: true }),
  test: (params) => services.post('/third-list-param/testing', { params, isLoading: true }),
  dataTypeList: (params) => services.post('/data-type/list', { params, isLoading: true }),
  interfaceGroupList: () => services.post('/third-list-map/map-group-list', { isLoading: true }),
  getInterfaceByGroup: (params) => services.get('/third-list-map/get-map-name-list', { params, isLoading: true }),
};

// 版本
export const version = {
  list: (params) => services.post('/third-param-version/list', { params, isLoading: true }),
  reset: (params) => services.post('/third-param-version/restore', { params, isLoading: true }),
  detail: (params) => services.post('/third-param-version/version-detail', { params, isLoading: true }),
};

// 风险类型管理
// export const riskType = {
//   add: (params) => services.post('/risk-type/create', { params, isLoading: true }),
//   update: (params) => services.post('/risk-type/edit', { params, isLoading: true }),
//   delete: (params) => services.post('/risk-type/delete', { params, isLoading: true }),
//   list: (params) => services.post('/risk-type/list', { params, isLoading: true }),
//   getCodeList: (params) => services.post('/risk-type/get-code-list', { params }),
// };

// 函数管理
export const fn = {
  list: (params) => servicesSmp.post('/func/page', { params }),
  allList: (params) => servicesSmp.post('/func/list', { params }),
  add: (params) => servicesSmp.post('/func/add', { params }),
  delete: (params) => servicesSmp.post('/func/delete', { params }),
  detail: (params) => servicesSmp.post('/func/detail', { params }),
  update: (params) => servicesSmp.post('/func/update', { params }),
  widthComponentList: (params) => servicesSmp.post('/func/with-component-list', { params }),
  widthStrategyList: (params) => servicesSmp.post('/func/with-strategy-list', { params }),
  checkRef: (params) => servicesSmp.post('/func/check-ref', { params }),
};

// 指标数据源
export const indexDataSource = {
  list: (params) => services.post('/feature-source/list', { params, isLoading: true }),
  add: (params) => services.post('/feature-source/create', { params, isLoading: true }),
  update: (params) => services.post('/feature-source/edit', { params, isLoading: true }),
  delete: (params) => services.post('/feature-source/delete', { params, isLoading: true }),
  relation: (params) => services.post('/feature-source/all-data-source', { params }),
};

// 名单同步
export const nameListConfig = {
  list: (params) => services.post('/namelist-config/list', { params, isLoading: true }),
  add: (params) => services.post('/namelist-config/create', { params, isLoading: true }),
  update: (params) => services.post('/namelist-config/update', { params, isLoading: true }),
  delete: (params) => services.post('/namelist-config/delete', { params, isLoading: true }),
  detail: (params) => services.post('/namelist-config/detail', { params, isLoading: true }),
  reset: (params) => services.post('/namelist-config/reset-sync-status', { params, isLoading: true }),
  operatorList: (params) => services.post('/namelist-config/operator-list', { params, isLoading: true }),
};

// 变量管理
export const vars = {
  list: (params) => servicesSmp.post('/var/page', { params }),
  listNoPage: (params) => servicesSmp.post('/var/list', { params }),
  add: (params) => servicesSmp.post('/var/add', { params }),
  detail: (params) => servicesSmp.post('/var/detail', { params }),
  delete: (params) => servicesSmp.post('/var/delete', { params }),
  update: (params) => servicesSmp.post('/var/update', { params }),
  varEnumList: (params) => servicesSmp.post('/var-enum/page', { params }),
  updateVarEnum: (params) => servicesSmp.post('/var-enum/update', { params }),
};

// 变量分类管理
export const sort = {
  list: (params) => servicesSmp.post('/var-category/page', { params }),
  listNoPage: (params) => servicesSmp.post('/var-category/getSimple', { params }),
  add: (params) => servicesSmp.post('/var-category/add', { params }),
  simple: (params) => servicesSmp.post('/var-category/getSimple', { params }),
  delete: (params) => servicesSmp.post('/var-category/delete', { params }),
};

// 标签管理
export const tag = {
  list: (params) => servicesSmp.post('/tag/page', { params }),
  listNoPage: (params) => servicesSmp.post('/tag/list', { params }),
  add: (params) => servicesSmp.post('/tag/add', { params }),
  delete: (params) => servicesSmp.post('/tag/delete', { params }),
  update: (params) => servicesSmp.post('/tag/update', { params }),
};

// 风险类型管理
export const riskType = {
  list: (params) => servicesSmp.post('/risk-type/page', { params }),
  add: (params) => servicesSmp.post('/risk-type/add', { params }),
  delete: (params) => servicesSmp.post('/risk-type/delete', { params }),
  update: (params) => servicesSmp.post('/risk-type/update', { params }),
  all: (params) => servicesSmp.post('/risk-type/list', { params }),
};

// 数据源
export const dataSourceMng = {
  type: (params) => servicesSmp.post('/dataSource/list', { params }),
  typeList: (params) => servicesSmp.post('/dataSource/dataList', { params }),
};
